package Model;

import java.io.Serializable;

import Messaging.Notification;
import Messaging.NotificationManager;

/* 
 * @author Mark de Lira
 */

public class UpgradeablePropertyLevel5 extends UpgradeablePropertyState implements Serializable
{
	
	private static UpgradeablePropertyLevel5 INSTANCE = null;
	final static long serialVersionUID = 227;
	
	protected UpgradeablePropertyLevel5()
	{
	
	}
	
	public static UpgradeablePropertyState Instance() 
	{
		if (INSTANCE == null)
		{
			INSTANCE = new UpgradeablePropertyLevel5();
		}
		
		return INSTANCE;
	}

	public void landOn(Player player, PropertySpace property) 
	{
		property.getOwner().collectRent(property.getRentValues()[5], player);
	}
	
	protected void renovate(UpgradeablePropertySpace p)
	{
		System.err.println("Renovate called on UpgradeablePropertyLevel5");
	}
	
	protected void downgrade(UpgradeablePropertySpace p)
	{
		p.changeState(UpgradeablePropertyLevel4.Instance());
		NotificationManager.getInstance().notifyObservers
		(Notification.UPDATE_PROPERTIES, new Player(p.getOwner()));
	}
	
	protected boolean isUpgradeable(UpgradeablePropertySpace p)
	{
		return false;
	}
	
	protected boolean isDowngradeable(UpgradeablePropertySpace p) 
	{
		return true;
	}
	
	protected String getNameAndStatus()
	{
		return " (Level 5)";
	}
	
	public int getLevel()
	{
		return 5;
	}
	
	public String toString()
	{
		return "UpgradeablePropertyLevel5";
	}
}
